const plugin_search_but = document.getElementById('plugin_search_but')
const plugin_search_inp = document.getElementById('plugin_search_inp')
plugin_search_but.onclick = async function () {
    // alert
    // alert('plugin_search_inp的值为：' + plugin_search_inp.value.trim())
    // console.log('chrome', chrome)
    // 向 Service Worker 发送消息
    // chrome.runtime.sendMessage({
    //   action: 'fromPopup',
    //   message: 'Hello from Popup!'
    // });
    const [tab] = await chrome.tabs.query({
        url: ["https://lkcoffee.com/*"],
        active: true,
        currentWindow: true
    });
    console.log('tab', tab)
    const connect = chrome.tabs.connect(tab.id, {name: 'fromPopup2Content'});
    console.log('connect', connect)
    connect.postMessage('这里是弹出框页面，你是谁？')
    connect.onMessage.addListener((mess) => {
        console.log(mess)
    })
}
